<!--
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 14:41:20
 * @LastEditTime: 2023-08-31 11:00:35
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description:   :gridOps="gridOptions" other
-->

<template>
	<el-row style="height: 100%;">
		<el-col style="height: 100%;">
			<el-row style="height: 46px;">
				<el-col>
					<el-form :inline="true">
						<el-form-item label="时间">
							<el-date-picker type="daterange" value-format="YYYY-MM-DD" v-model="form.potdate"
								style="width: 190px;" />
						</el-form-item>
						<el-form-item label="客户">
							<skAutoChoose v-model="form.company_name.value" :name="'customer'"
								:params="[{ name: { type: 'nlr', value: 'YZ', } }]">
							</skAutoChoose>
						</el-form-item>
						<el-form-item label="">
							<el-button-group>
								<el-button type="primary" @click="search">查询</el-button>
								<el-button @click="reset">重置</el-button>
							</el-button-group>
						</el-form-item>
					</el-form>
				</el-col>
			</el-row>
			<el-row style="height:calc(100% - 46px);">
				<el-col :span="12" style="height:100%;">
					<sc-VxeTable ref="xGridPlan" :tablecode="'pro_plan_pot_report'" :url="api.pro.pot.list"
						:params="getPlanParams">
					</sc-VxeTable>
				</el-col>
				<el-col :span="12" style="height:100%;border-left: 1px solid #ccc;">
					<sc-VxeTable ref="xGridPot" :tablecode="'pro_plan_pot_report'" :params="getPotParams"
						:url="api.pro.pot.list"></sc-VxeTable>
				</el-col>
			</el-row>
		</el-col>
	</el-row>
</template>

<script>
export default {
	name: "pro_report_potplan",
};
</script>

<script setup>
import tool from '@/utils/tool';
import skAutoChoose from "@/components/skAutoChoose";
import { ref } from "vue";
import api from "@/api";
const xGridPot = ref({});
const xGridPlan = ref({});
const form = ref({
	potdate: [tool.SYS_DATE(), tool.SYS_DATE()],
	company_name: {
		type: 'lk',
		value: 'HS朱永华'
	}
})

const getPlanParams = () => {
	let p = tool.removeNull(form.value);
	p.company_name.value = p.company_name.value.trim();
	p.is_kk = 1;
	return p;
}
const getPotParams = () => {
	let p = tool.removeNull(form.value);
	p.process_id = 6;
	return p;
}
const search = () => {
	xGridPot.value.refresh();
	xGridPlan.value.refresh();
}
const reset = () => {
	form.value = {
		potdate: [tool.SYS_DATE(), tool.SYS_DATE()],
		company_name: {
			type: 'lk',
			value: 'HS朱永华'
		}
	}
	xGridPot.value.refresh();
	xGridPlan.value.refresh();
}
</script>
